/**
 * IP报文类
 */
#ifndef __PACK_IP_H_INCLUDED__
#define __PACK_IP_H_INCLUDED__

#include <string>
using std::string;

#include <netinet/ip.h>

#ifdef __cplusplus
extern "C" {
#endif

class pack_ip{

public:

	pack_ip(void* ptr);
	~pack_ip();
	string get_saddr();
	string get_daddr();
	uint32_t get_saddr_uint();
	uint32_t get_daddr_uint();
	void set_saddr(const char* ip);
	void set_daddr(const char* ip);
	void set_saddr(uint32_t addr);
	void set_daddr(uint32_t addr);
	uint32_t get_head_len();
	uint32_t get_total_len();
	uint8_t get_protocol();
	uint16_t get_check();
	char* get_transfer_layer();
	void print_buffer();

public:

	pack_ip();

	iphdr* ptr;
};

#ifdef __cplusplus
}
#endif

#endif // __PACK_IP_H_INCLUDED__
